<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Freetype OpenGL: vector.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="style.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="content"><!-- do not remove this div! -->

<div id="top"><!-- do not remove this div! -->

  
  <div id="titlearea">
    
    <div id="projectname">Freetype OpenGL</div>
    
    
    <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
    
  </div>
  

<!--

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Freetype OpenGL
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>
-->


<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript" src="dynsections.js"></script>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">vector.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="vector_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* ============================================================================</span>
<a name="l00002"></a>00002 <span class="comment"> * Freetype GL - A C OpenGL Freetype engine</span>
<a name="l00003"></a>00003 <span class="comment"> * Platform:    Any</span>
<a name="l00004"></a>00004 <span class="comment"> * WWW:         http://code.google.com/p/freetype-gl/</span>
<a name="l00005"></a>00005 <span class="comment"> * ----------------------------------------------------------------------------</span>
<a name="l00006"></a>00006 <span class="comment"> * Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00009"></a>00009 <span class="comment"> * modification, are permitted provided that the following conditions are met:</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> *  1. Redistributions of source code must retain the above copyright notice,</span>
<a name="l00012"></a>00012 <span class="comment"> *     this list of conditions and the following disclaimer.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> *  2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00015"></a>00015 <span class="comment"> *     notice, this list of conditions and the following disclaimer in the</span>
<a name="l00016"></a>00016 <span class="comment"> *     documentation and/or other materials provided with the distribution.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER &#39;&#39;AS IS&#39;&#39; AND ANY EXPRESS OR</span>
<a name="l00019"></a>00019 <span class="comment"> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF</span>
<a name="l00020"></a>00020 <span class="comment"> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO</span>
<a name="l00021"></a>00021 <span class="comment"> * EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</span>
<a name="l00022"></a>00022 <span class="comment"> * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span>
<a name="l00023"></a>00023 <span class="comment"> * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span>
<a name="l00024"></a>00024 <span class="comment"> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span>
<a name="l00025"></a>00025 <span class="comment"> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
<a name="l00026"></a>00026 <span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF</span>
<a name="l00027"></a>00027 <span class="comment"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00028"></a>00028 <span class="comment"> *</span>
<a name="l00029"></a>00029 <span class="comment"> * The views and conclusions contained in the software and documentation are</span>
<a name="l00030"></a>00030 <span class="comment"> * those of the authors and should not be interpreted as representing official</span>
<a name="l00031"></a>00031 <span class="comment"> * policies, either expressed or implied, of Nicolas P. Rougier.</span>
<a name="l00032"></a>00032 <span class="comment"> * ============================================================================</span>
<a name="l00033"></a>00033 <span class="comment"> */</span>
<a name="l00034"></a>00034 <span class="preprocessor">#ifndef __VECTOR_H__</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#define __VECTOR_H__</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00039"></a>00039 <span class="preprocessor">#endif</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &lt;stddef.h&gt;</span>
<a name="l00042"></a>00042 
<a name="l00079"></a><a class="code" href="structvector__t.html">00079</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00080"></a>00080  {
<a name="l00082"></a><a class="code" href="structvector__t.html#a083c597f2ae3b6302b26ba9e6330ee5f">00082</a>      <span class="keywordtype">void</span> * <a class="code" href="structvector__t.html#a083c597f2ae3b6302b26ba9e6330ee5f" title="Pointer to dynamically allocated items.">items</a>;
<a name="l00083"></a>00083 
<a name="l00085"></a><a class="code" href="structvector__t.html#a81e18fd00e94087a8f04b657ffc34c04">00085</a>      <span class="keywordtype">size_t</span> <a class="code" href="structvector__t.html#a81e18fd00e94087a8f04b657ffc34c04" title="Number of items that can be held in currently allocated storage.">capacity</a>;
<a name="l00086"></a>00086 
<a name="l00088"></a><a class="code" href="structvector__t.html#a7ec97862387465722f8f08f8f8f69371">00088</a>      <span class="keywordtype">size_t</span> <a class="code" href="structvector__t.html#a7ec97862387465722f8f08f8f8f69371" title="Number of items.">size</a>;
<a name="l00089"></a>00089 
<a name="l00091"></a><a class="code" href="structvector__t.html#a38dfa6c7c9cf7afb483b07cb168461c9">00091</a>      <span class="keywordtype">size_t</span> <a class="code" href="structvector__t.html#a38dfa6c7c9cf7afb483b07cb168461c9" title="Size (in bytes) of a single item.">item_size</a>;
<a name="l00092"></a>00092 } <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a>;
<a name="l00093"></a>00093 
<a name="l00094"></a>00094 
<a name="l00102"></a>00102   <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *
<a name="l00103"></a>00103   <a class="code" href="group__vector.html#ga9ab13f896bb29debbbf8175e75751ea5" title="Creates a new empty vector.">vector_new</a>( <span class="keywordtype">size_t</span> item_size );
<a name="l00104"></a>00104 
<a name="l00105"></a>00105 
<a name="l00112"></a>00112   <span class="keywordtype">void</span>
<a name="l00113"></a>00113   <a class="code" href="group__vector.html#gae045e222efa8898716f8322c5667f624" title="Deletes a vector.">vector_delete</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 
<a name="l00123"></a>00123   <span class="keyword">const</span> <span class="keywordtype">void</span> *
<a name="l00124"></a>00124   <a class="code" href="group__vector.html#ga6ed3fefa82526009ff0763191dcd9a93" title="Returns a pointer to the item located at specified index.">vector_get</a>( <span class="keyword">const</span> <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00125"></a>00125               <span class="keywordtype">size_t</span> index );
<a name="l00126"></a>00126 
<a name="l00127"></a>00127 
<a name="l00134"></a>00134   <span class="keyword">const</span> <span class="keywordtype">void</span> *
<a name="l00135"></a>00135   <a class="code" href="group__vector.html#ga89ea189955bd6c4873aca8288c96ad1b" title="Returns a pointer to the first item.">vector_front</a>( <span class="keyword">const</span> <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00136"></a>00136 
<a name="l00137"></a>00137 
<a name="l00144"></a>00144   <span class="keyword">const</span> <span class="keywordtype">void</span> *
<a name="l00145"></a>00145   <a class="code" href="group__vector.html#ga1b74708d66280dbf5865bb51e8f5c394" title="Returns a pointer to the last item.">vector_back</a>( <span class="keyword">const</span> <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 
<a name="l00156"></a>00156   <span class="keywordtype">int</span>
<a name="l00157"></a>00157   <a class="code" href="group__vector.html#ga3449b56bc57599ceca39ee5960057ac4" title="Check if an item is contained within the vector.">vector_contains</a>( <span class="keyword">const</span> <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00158"></a>00158                    <span class="keyword">const</span> <span class="keywordtype">void</span> *item,
<a name="l00159"></a>00159                    <span class="keywordtype">int</span> (*cmp)(<span class="keyword">const</span> <span class="keywordtype">void</span> *, <span class="keyword">const</span> <span class="keywordtype">void</span> *) );
<a name="l00160"></a>00160 
<a name="l00161"></a>00161 
<a name="l00168"></a>00168   <span class="keywordtype">int</span>
<a name="l00169"></a>00169   <a class="code" href="group__vector.html#ga0d33ab9aaff247d38876b1fe76c4e2ef" title="Checks whether the vector is empty.">vector_empty</a>( <span class="keyword">const</span> <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00170"></a>00170 
<a name="l00171"></a>00171 
<a name="l00178"></a>00178   <span class="keywordtype">size_t</span>
<a name="l00179"></a>00179   <a class="code" href="group__vector.html#ga0103842074bb797fc685b33c0629c05a" title="Returns the number of items.">vector_size</a>( <span class="keyword">const</span> <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00180"></a>00180 
<a name="l00181"></a>00181 
<a name="l00188"></a>00188   <span class="keywordtype">void</span>
<a name="l00189"></a>00189   <a class="code" href="group__vector.html#ga1a1e63e13a4da5587aa0b9369580eb85" title="Reserve storage such that it can hold at last size items.">vector_reserve</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00190"></a>00190                   <span class="keyword">const</span> <span class="keywordtype">size_t</span> size );
<a name="l00191"></a>00191 
<a name="l00192"></a>00192 
<a name="l00199"></a>00199   <span class="keywordtype">size_t</span>
<a name="l00200"></a>00200   <a class="code" href="group__vector.html#ga94c636cfdfd80206e765331d8b44651e" title="Returns current storage capacity.">vector_capacity</a>( <span class="keyword">const</span> <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00201"></a>00201 
<a name="l00202"></a>00202 
<a name="l00208"></a>00208   <span class="keywordtype">void</span>
<a name="l00209"></a>00209   <a class="code" href="group__vector.html#ga0b9c4f4cf48f0c52daa7852aeb7e531c" title="Decrease capacity to fit actual size.">vector_shrink</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00210"></a>00210 
<a name="l00211"></a>00211 
<a name="l00217"></a>00217   <span class="keywordtype">void</span>
<a name="l00218"></a>00218   <a class="code" href="group__vector.html#gaa24245f42c8bb6f84933133f6a560deb" title="Removes all items.">vector_clear</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00219"></a>00219 
<a name="l00220"></a>00220 
<a name="l00228"></a>00228   <span class="keywordtype">void</span>
<a name="l00229"></a>00229   <a class="code" href="group__vector.html#ga50c566682c6ec48ef8f7f4224c112d03" title="Replace an item.">vector_set</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00230"></a>00230               <span class="keyword">const</span> <span class="keywordtype">size_t</span> index,
<a name="l00231"></a>00231               <span class="keyword">const</span> <span class="keywordtype">void</span> *item );
<a name="l00232"></a>00232 
<a name="l00233"></a>00233 
<a name="l00240"></a>00240   <span class="keywordtype">void</span>
<a name="l00241"></a>00241   <a class="code" href="group__vector.html#ga99460cea333533ca48e5cb23c37642f0" title="Erase an item.">vector_erase</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00242"></a>00242                 <span class="keyword">const</span> <span class="keywordtype">size_t</span> index );
<a name="l00243"></a>00243 
<a name="l00244"></a>00244 
<a name="l00252"></a>00252   <span class="keywordtype">void</span>
<a name="l00253"></a>00253   <a class="code" href="group__vector.html#ga089b70be0dbd06c497470359e725b4ef" title="Erase a range of items.">vector_erase_range</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00254"></a>00254                       <span class="keyword">const</span> <span class="keywordtype">size_t</span> first,
<a name="l00255"></a>00255                       <span class="keyword">const</span> <span class="keywordtype">size_t</span> last );
<a name="l00256"></a>00256 
<a name="l00257"></a>00257 
<a name="l00264"></a>00264   <span class="keywordtype">void</span>
<a name="l00265"></a>00265   <a class="code" href="group__vector.html#ga0934c3049233d3688b7fa74e23536bbf" title="Appends given item to the end of the vector.">vector_push_back</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00266"></a>00266                     <span class="keyword">const</span> <span class="keywordtype">void</span> *item );
<a name="l00267"></a>00267 
<a name="l00268"></a>00268 
<a name="l00274"></a>00274   <span class="keywordtype">void</span>
<a name="l00275"></a>00275   <a class="code" href="group__vector.html#ga03f7948a7302fda208afe31bf7f324eb" title="Removes the last item of the vector.">vector_pop_back</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span> );
<a name="l00276"></a>00276 
<a name="l00277"></a>00277 
<a name="l00288"></a>00288   <span class="keywordtype">void</span>
<a name="l00289"></a>00289   <a class="code" href="group__vector.html#gae88ff6d21d8f963ba97790086d18506a" title="Resizes the vector to contain size items.">vector_resize</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00290"></a>00290                  <span class="keyword">const</span> <span class="keywordtype">size_t</span> size );
<a name="l00291"></a>00291 
<a name="l00292"></a>00292 
<a name="l00300"></a>00300   <span class="keywordtype">void</span>
<a name="l00301"></a>00301   <a class="code" href="group__vector.html#gaa69087a65fe41ccc9a6763053a0db7da" title="Insert a single item at specified index.">vector_insert</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00302"></a>00302                  <span class="keyword">const</span> <span class="keywordtype">size_t</span> index,
<a name="l00303"></a>00303                  <span class="keyword">const</span> <span class="keywordtype">void</span> *item );
<a name="l00304"></a>00304 
<a name="l00305"></a>00305 
<a name="l00314"></a>00314   <span class="keywordtype">void</span>
<a name="l00315"></a>00315   <a class="code" href="group__vector.html#gaea8a2ae4d0d06d93f38b24697a5ac5ec" title="Insert raw data at specified index.">vector_insert_data</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00316"></a>00316                       <span class="keyword">const</span> <span class="keywordtype">size_t</span> index,
<a name="l00317"></a>00317                       <span class="keyword">const</span> <span class="keywordtype">void</span> * data,
<a name="l00318"></a>00318                       <span class="keyword">const</span> <span class="keywordtype">size_t</span> count );
<a name="l00319"></a>00319 
<a name="l00320"></a>00320 
<a name="l00328"></a>00328   <span class="keywordtype">void</span>
<a name="l00329"></a>00329   <a class="code" href="group__vector.html#gaabe89daaacdda4c42daf166e2f52f159" title="Append raw data to the end of the vector.">vector_push_back_data</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00330"></a>00330                          <span class="keyword">const</span> <span class="keywordtype">void</span> * data, 
<a name="l00331"></a>00331                          <span class="keyword">const</span> <span class="keywordtype">size_t</span> count );
<a name="l00332"></a>00332 
<a name="l00333"></a>00333 
<a name="l00340"></a>00340   <span class="keywordtype">void</span>
<a name="l00341"></a>00341   <a class="code" href="group__vector.html#gaee95bbc2e143793c2ffdf3f107aac1bd" title="Sort vector items according to cmp function.">vector_sort</a>( <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> *<span class="keyword">self</span>,
<a name="l00342"></a>00342                <span class="keywordtype">int</span> (*cmp)(<span class="keyword">const</span> <span class="keywordtype">void</span> *, <span class="keyword">const</span> <span class="keywordtype">void</span> *) );
<a name="l00343"></a>00343 
<a name="l00344"></a>00344 
<a name="l00347"></a>00347 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00348"></a>00348 <span class="preprocessor"></span>}
<a name="l00349"></a>00349 <span class="preprocessor">#endif</span>
<a name="l00350"></a>00350 <span class="preprocessor"></span>
<a name="l00351"></a>00351 <span class="preprocessor">#endif </span><span class="comment">/* __VECTOR_H__ */</span>
</pre></div></div><!-- contents -->
</div>
</body>
</html>
